<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1" import="com.sakila.dao.FilmDAO"
	import="java.util.List" import="java.util.Map"
	import="com.sakila.services.FilmActorServiceImpl"
	import="com.sakila.dbo.FilmDBO" import="com.sakila.dbo.ActorDBO" import="java.util.Iterator"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>

	<%
		FilmActorServiceImpl film = new FilmActorServiceImpl();
		List<Map<Integer, List<ActorDBO>>> flist = film.getActorsByFilm();
		for (Map<Integer, List<ActorDBO>> map : flist) {
			Iterator<Integer> it = map.keySet().iterator();
			while (it.hasNext()) {
				Integer key = it.next();
				FilmDBO abo = new FilmDAO().findById(key);
				
	%>
	<br><table border="1">
		<tr bgcolor="yellow">
			<th>Film ID</th>
			<th>Title</th>
			<th>Release Year</th>
			<th>Rating</th>
			<th>Rental Rate</th>
			<th>Special Features</th>
		</tr>
		
		<tr bgcolor="lightblue">
			<td><%=abo.getFilm_id()%></td>
			<td><%=abo.getTitle()%></td>
			<td><%=abo.getRelease_year()%></td>
			<td><%=abo.getRating()%></td>
			<td><%=abo.getRental_rate()%></td>
			<td><%=abo.getSpecial_features()%></td>
		</tr>
		
	</table>

	<br>
	<%
		List<ActorDBO> actorlist = map.get(key);
				//for (ActorDBO actor : actorlist) {
					//System.out.println(actor);
	%>
	
	<table border="1">
   <tr bgcolor="yellow">
     <th>Actor ID</th>
     <th>First Name</th>
     <th>Last Name</th>
     <th>Last Update</th>
   </tr>
   <%
   	for(ActorDBO aco: actorlist){
   %>
   <tr bgcolor="lightblue">
     <td><%= aco.getActorID()%></td>
     <td><%=aco.getFirstName()%></td>
     <td><%=aco.getLastName()%></td>
    <td><%=aco.getLastUpdate()%></td> 
   </tr>
   <%} %>
 </table>
	
	
	<%-- <%=actor.getFirstName()%> --%>

	<%
		}
			}
		
	%>





</body>
</html>